<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<button onclick="addImg()">点我</button>
<script>
    function addImg(){
        let imgEle = document.createElement('img');
        console.log(imgEle);
        
        imgEle.src = './img.png';
   imgEle.width =400;
        document.body.append(imgEle)
    }
</script>

</body>
</html>